<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="ru" xml:lang="ru"> 
    <head>
	<title>LocalCRM</title>
	<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
	<script src="js/jquery-ui-1.8.4.custom.min.js" type="text/javascript"></script>
	<script src="js/jquery.blockUI.js" type="text/javascript"></script>
	<script src="js/crm/common.js" type="text/javascript"></script>
	<link href="css/redmond/jquery-ui-1.8.4.custom.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
	<div class="tabs">
	    <ul>
		<li><a href="#info">Карточка</a></li>
		<li><a href="#bank">Реквизиты</a></li>
		<li><a href="#contact">Контакты</a></li>
		<li><a href="#document">Документы</a></li>
	    </ul>
	    <div id="info">
		<table align="center" class="ui-widget">
		    <tr>
			<td align="right">Клиент:</td>
			<td colspan="3">{$customer.customer_name|sslash}</td>
		    </tr>
		    {if $contract!=''}
		    <tr>
			<td align="right">Номер договора:</td>
			<td colspan="3"><strong>{$contract.contract_number}</strong>{if $contract.accepted_date!=''} от {$contract.accepted_date|date_format:'%d.%m.%Y'}{/if}</td>
		    </tr>
		    {/if}
		    {if $manager!=''}
		    <tr>
			<td align="right">Ваш менеджер:</td>
			<td colspan="3">{$manager.manager_name}</td>
		    </tr>
		    {/if}
		    <tr>
			<td align="right">E-Mail:</td>
			<td colspan="3">{if $customer.email!=''}{mailto address=$customer.email}{/if}</td>
		    </tr>
		    <tr><td colspan="4">&nbsp;</td></tr>
		</table>
	    </div>
	    <div id="contact">
		<table class="ui-widget ui-corner-top" width="75%" align="center" cellspacing="0" rules="all" style="border: solid 1px #000000;">
		    <thead class="ui-widget-header">
			<tr>
			    <th>#</th>
			    <th>ФИО</th>
			    <th>Должность</th>
			    <th>Телефон</th>
			    <th>E-Mail</th>
			    <th>Примечание</th>
			</tr>
		    </thead>
		    <tbody>
		    {foreach from=$contacts item=contact name=contacts}
			<tr>
			    <td align="center">{$smarty.foreach.contacts.iteration}</td>
			    <td>{$contact.contact_name}</td>
			    <td>{$contact.post}</td>
			    <td>{$contact.phone_number}</td>
			    <td>{if $contact.email}{mailto address=$contact.email}{else}&mdash;{/if}</td>
			    <td>{$contact.note}</td>
			</tr>
		    {foreachelse}
			<tr><td align="center" colspan="7"><i>контактов не найдено</i></td></tr>
		    {/foreach}
		    </tbody>
		</table>
	    </div>
	    <div id="bank">

		<table width="70%">
		    <tr>
			<th>&nbsp;</th>
			<th colspan="2">Реквизиты</th>
		    </tr>
		    <tr>
			<td rowspan="8">
			    {if $customer.legal_home!=0}
			    <p>
				<span>Юридический адрес:</span><br/>
				{$customer.legal_index}, {$customer.legal_region}, {$customer.legal_city}<br/>
				{$customer.legal_street}, д.{$customer.legal_home}{if $customer.legal_litera!=''}-${$customer.legal_litera}{/if}, оф.{$customer.legal_office}
			    </p>
			    {/if}
			    {if $customer.actual_home!=0}
			    <p>
				<span>Фактический адрес:</span><br/>
				{$customer.actual_index}, {$customer.actual_region}, {$customer.actual_city}<br/>
				{$customer.actual_street}, д.{$customer.actual_home}{if $customer.actual_litera!=''}-${$customer.actual_litera}{/if}, оф.{$customer.actual_office}
			    </p>
			    {/if}
			    {if $customer.postal_home!=0}
			    <p>
				<span>Почтовый адрес:</span><br/>
				{$customer.postal_index}, {$customer.postal_region}, {$customer.postal_city}<br/>
				{$customer.postal_street}, д.{$customer.postal_home}{if $customer.postal_litera!=''}-${$customer.postal_litera}{/if}, оф.{$customer.postal_office}
			    </p>
			    {/if}
			</td>
			{if $customer.inn!=0}
			<td align="right">ИНН:</td>
			<td>{$customer.inn}</td>
			{else}
			<td colspan="2">&nbsp;</td>
			{/if}
		    </tr>
		    {if $customer.kpp!=0}
		    <tr>
			<td align="right">КПП:</td>
			<td>{$customer.kpp}</td>
		    </tr>
		    {/if}
		    {if $customer.okpo!=0}
		    <tr>
			<td align="right">ОКПО:</td>
			<td>{$customer.okpo}</td>
		    </tr>
		    {/if}
		    {if $customer.okonh!=0}
		    <tr>
			<td align="right">ОКОНХ:</td>
			<td>{$customer.okonh}</td>
		    </tr>
		    {/if}
		    {if $customer.bik!=0}
		    <tr>
			<td align="right">БИК:</td>
			<td>{$customer.bik}</td>
		    </tr>
		    {/if}
		    {if $customer.bank!=''}
		    <tr>
			<td align="right">БАНК:</td>
			<td>{$customer.bank|sslash|escape}</td>
		    </tr>
		    {/if}
		    {if $customer.current_account!=0}
		    <tr>
			<td align="right">Р/С:</td>
			<td>{$customer.current_account}</td>
		    </tr>
		    {/if}
		    {if $customer.korr_account!=0}
		    <tr>
			<td align="right">К/С:</td>
			<td>{$customer.korr_account}</td>
		    </tr>
		    {/if}
		</table>
	    </div>
	    <div id="document">
		<div class="tabs">
		    <ul>
			<li><a href="#doc-regular">Основные</a></li>
			<li><a href="#doc-ttk">Расчётные документы</a></li>
		    </ul>
		    <div id="doc-regular">
			<table class="ui-widget" cellspacing="0" rules="all" style="border: solid 1px #000000;">
			    <thead class="ui-widget-header">
				<tr>
				    <th>Дата</th>
				    <th>Номер документа</th>
				    <th>Название документа</th>
				    <th>Файл</th>
				    <th>&nbsp;</th>
				</tr>
			    </thead>
			    <tbody class="ui-widget-content">
			    {foreach from=$docs_regular item=doc}
				{assign var="mime" value=$doc.filename|regex_replace:'/.+\.(.+)$/':'$1'|lower}
				<tr>
				    <td>{$doc.document_date|date_format:'%d.%m.%Y'}</td>
				    <td>{$doc.document_num}</td>
				    <td>{$doc.document_name}</td>
				    <td>
					<a href="/cgi-bin/dl.cgi?id={$doc.id}">
					    {if $mime=='jpg' || $mime=='gif' || $mime=='png' || $mime=='bmp'}
					    <img src="images/icons/mimetypes/image.png" border="0"/>
					    {elseif $mime=='pdf'}
					    <img src="images/icons/mimetypes/pdf-document.png" border="0"/>
					    {elseif $mime=='txt'}
					    <img src="images/icons/mimetypes/txt.png" border="0"/>
					    {else}
					    <img src="images/icons/mimetypes/unknown.png" border="0"/>
					    {/if}
					    {$doc.filename}
					</a>
					<i>({math equation='x/1024' x=$doc.size format='%0.2f'} КБ)</i>
				    </td>
				</tr>
			    {foreachelse}
				<tr><td align="center" colspan="5"><i>документы не загружены</i></td></tr>
			    {/foreach}
			    </tbody>
			</table>
		    </div>
		    <div id="doc-ttk">
			<table class="ui-widget" cellspacing="0" rules="all" style="border: solid 1px #000000;">
			    <thead class="ui-widget-header">
				<tr>
				    <th>Дата</th>
				    <th>Название документа</th>
				    <th>Файл</th>
				</tr>
			    </thead>
			    <tbody class="ui-widget-content">
			    {foreach from=$docs_ttk item=doc}
				{assign var="mime" value=$doc.filename|regex_replace:'/.+\.(.+)$/':'$1'|lower}
				<tr>
				    <td>{$doc.document_date|date_format:'%d.%m.%Y'}</td>
				    <td>{$doc.document_name}</td>
				    <td>
					<a href="/cgi-bin/dl.cgi?id={$doc.id}">
					{if $mime=='jpg' || $mime=='gif' || $mime=='png' || $mime=='bmp'}
					    <img src="images/icons/mimetypes/image.png" border="0"/>
					{elseif $mime=='pdf'}
					    <img src="images/icons/mimetypes/pdf-document.png" border="0"/>
					{elseif $mime=='txt'}
					    <img src="images/icons/mimetypes/txt.png" border="0"/>
					{else}
					    <img src="images/icons/mimetypes/unknown.png" border="0"/>
					{/if}
					    {$doc.filename}
					</a>
					<i>({math equation='x/1024' x=$doc.size format='%0.2f'} КБ)</i>
				    </td>
				</tr>
			    {foreachelse}
				<tr><td align="center" colspan="5"><i>документы не загружены</i></td></tr>
			    {/foreach}
			    </tbody>
			</table>
		    </div>
		</div>
	    </div>
	</div>
    </body>
</html>
